//
// Decompiled by Jadx - 496ms
//
package me.plusne;

import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.t;
import androidx.constraintlayout.widget.i;
import cc.b;
import com.google.gson.Gson;
import com.gyf.immersionbar.OSUtils;
import fg.w;
import fi.c;
import fi.e;
import fn.y;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import me.plusne.common.Http.Home;
import me.plusne.common.Json.JsonHomeAppList;
import me.plusne.common.Json.JsonHomeAppVersionList;
import me.plusne.common.Json.JsonHomeAppVersionSetList;
import r.a;
import r.f;
import r.g;
import r.h;
import s.p;

public class MainActivity extends AppCompatActivity {
    public static String w;
    public static long x;
    public static String y;
    public w aa;
    public b z;

    @SuppressLint({"SetTextI18n"})
    private void checkState(boolean z) {
        int i;
        String str;
        ImageView imageView = (ImageView) this.z.g;
        if (z) {
            i = -2113404831;
        } else {
            i = -2113404830;
        }
        imageView.setImageResource(i);
        TextView textView = this.z.d;
        StringBuilder sb = new StringBuilder();
        sb.append(w);
        sb.append(" ");
        if (z) {
            str = "未激活(非root不显示激活状态)";
        } else {
            str = "已激活";
        }
        sb.append(str);
        textView.setText(sb.toString());
        try {
            y = a.a(this, "me.plusne").versionName;
            x = a.b(this, "me.plusne");
            this.z.f.setText(y + " (" + x + ")");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public final void ab(JsonHomeAppVersionSetList jsonHomeAppVersionSetList, String str) {
        String sb;
        fi.w wVar = new fi.w(this);
        wVar.bj(fi.e.LIST_ITEM);
        wVar.bi(jsonHomeAppVersionSetList.getApp());
        wVar.bc(str);
        wVar.be();
        wVar.bd();
        if (jsonHomeAppVersionSetList.getGroup() != null) {
            c cVar = new c();
            cVar.setList(new ArrayList<>());
            cVar.setTitle("");
            cVar.setGroup(false);
            cVar.setGravity(8388611);
            for (JsonHomeAppVersionSetList.GroupBean groupBean : jsonHomeAppVersionSetList.getGroup()) {
                for (JsonHomeAppVersionSetList.DataBean dataBean : jsonHomeAppVersionSetList.getData()) {
                    if (groupBean.getUuid().equals(dataBean.getUuid())) {
                        StringBuilder sb2 = new StringBuilder();
                        sb2.append(g.l("[" + groupBean.getTitle() + "] ", String.format("#%06X", Integer.valueOf(getResources().getColor(-2113535963, null) & 16777215))));
                        sb2.append(dataBean.getTitle());
                        String sb3 = sb2.toString();
                        if (TextUtils.isEmpty(dataBean.getDesc())) {
                            sb = g.l("[" + dataBean.getLevel() + "]", "#98DBF8");
                        } else {
                            StringBuilder sb4 = new StringBuilder();
                            sb4.append(dataBean.getDesc());
                            sb4.append("\n");
                            sb4.append(g.l("[" + dataBean.getLevel() + "]", "#98DBF8"));
                            sb = sb4.toString();
                        }
                        String uuid = dataBean.getUuid();
                        c.a aVar = new c.a();
                        aVar.setTitle(sb3);
                        aVar.setDesc(sb);
                        aVar.setKey(uuid);
                        aVar.setRightText((String) null);
                        aVar.setArrow(false);
                        aVar.setHideArrow(true);
                        cVar.getList().add(aVar);
                    }
                }
            }
            wVar.aq.add(cVar);
            fg.b bVar = wVar.y;
            if (bVar != null) {
                bVar.notifyItemChanged(r3.size() - 1);
            }
        } else {
            f fVar = new f(this);
            fVar.j();
            fVar.l("Group数据为空");
        }
        wVar.bk();
    }

    public final void ac(JsonHomeAppVersionList jsonHomeAppVersionList) {
        fi.w wVar = new fi.w(this);
        wVar.bj(fi.e.LIST_ITEM);
        wVar.bi(jsonHomeAppVersionList.getApp());
        wVar.bc("每个版本的功能有区别,请按照你要使用的版本查看功能" + g.l("\n(适配版本请自行到应用商店下载)", "#38B549") + "\n理论兼容所有最新版本(无需特意下载某个版本)");
        c cVar = new c();
        cVar.setList(new ArrayList());
        cVar.setTitle("");
        cVar.setGroup(false);
        cVar.setGravity(8388611);
        if (jsonHomeAppVersionList.getData().isEmpty()) {
            f fVar = new f(this);
            fVar.j();
            fVar.l("当前App没有适配版本");
            return;
        }
        for (JsonHomeAppVersionList.DataBean dataBean : jsonHomeAppVersionList.getData()) {
            String str = dataBean.getVername() + "(" + dataBean.getVersion() + ")";
            String valueOf = String.valueOf(dataBean.getVersion());
            c.a aVar = new c.a();
            aVar.setTitle(str);
            aVar.setDesc("");
            aVar.setKey(valueOf);
            aVar.setRightText((String) null);
            aVar.setArrow(false);
            aVar.setHideArrow(false);
            cVar.getList().add(aVar);
        }
        wVar.aq.add(cVar);
        fg.b bVar = wVar.y;
        if (bVar != null) {
            bVar.notifyItemChanged(r2.size() - 1);
        }
        wVar.be();
        wVar.bd();
        wVar.ae = new fg.f(17, this, jsonHomeAppVersionList);
        wVar.bk();
    }

    public final void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        y.by.setActivity(this);
        Intent intent = getIntent();
        String stringExtra = intent.getStringExtra("PackageName");
        String stringExtra2 = intent.getStringExtra("ActivityClassName");
        if (!TextUtils.isEmpty(stringExtra) && !TextUtils.isEmpty(stringExtra2)) {
            Intent intent2 = new Intent();
            intent2.setComponent(new ComponentName(stringExtra, stringExtra2));
            intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent2);
            System.exit(0);
            return;
        }
        String stringExtra3 = intent.getStringExtra("typeState");
        if (!TextUtils.isEmpty(stringExtra3) && stringExtra3.equals("reg")) {
            new p(this);
        }
        View inflate = getLayoutInflater().inflate(-2113142756, null, false);
        int i = 0x7f8200bc;
        ImageView imageView = (ImageView) i.cg(0x7f8200bc, inflate);
        if (imageView != null) {
            i = 0x7f820114;
            ListView listView = (ListView) i.cg(0x7f820114, inflate);
            if (listView != null) {
                i = 0x7f820115;
                if (((LinearLayout) i.cg(0x7f820115, inflate)) != null) {
                    i = 0x7f820167;
                    TextView textView = (TextView) i.cg(0x7f820167, inflate);
                    if (textView != null) {
                        i = 0x7f820178;
                        TextView textView2 = (TextView) i.cg(0x7f820178, inflate);
                        if (textView2 != null) {
                            i = 0x7f820189;
                            TextView textView3 = (TextView) i.cg(0x7f820189, inflate);
                            if (textView3 != null) {
                                i = 0x7f8201d1;
                                TextView textView4 = (TextView) i.cg(0x7f8201d1, inflate);
                                if (textView4 != null) {
                                    i = 0x7f8201d2;
                                    TextView textView5 = (TextView) i.cg(0x7f8201d2, inflate);
                                    if (textView5 != null) {
                                        i = 0x7f820233;
                                        ImageView imageView2 = (ImageView) i.cg(0x7f820233, inflate);
                                        if (imageView2 != null) {
                                            LinearLayout linearLayout = (LinearLayout) inflate;
                                            this.z = new b(linearLayout, imageView, listView, textView, textView2, textView3, textView4, textView5, imageView2);
                                            setContentView(linearLayout);
                                            w = getResources().getString(-2112880612);
                                            checkState(true);
                                            this.z.b.setText(getResources().getString(-2112880612));
                                            this.z.e.setOnClickListener(new ff.a(this, 2));
                                            r.e.d(-2113535966, r.e.a(this, 10.0f), (ListView) this.z.h);
                                            r.e.d(-2113535773, r.e.a(this, 10.0f), this.z.c);
                                            r.e.d(-2113535773, r.e.a(this, 10.0f), this.z.a);
                                            this.aa = new w(this);
                                            JsonHomeAppList jsonHomeAppList = (JsonHomeAppList) new Gson().fromJson(fn.b.g("HomeAppList", ""), JsonHomeAppList.class);
                                            if (jsonHomeAppList != null && jsonHomeAppList.getData() != null && !jsonHomeAppList.getData().isEmpty()) {
                                                int toDay = jsonHomeAppList.getToDay();
                                                Date date = h.a;
                                                if (toDay == Calendar.getInstance().get(7)) {
                                                    w wVar = this.aa;
                                                    wVar.b = jsonHomeAppList;
                                                    wVar.notifyDataSetChanged();
                                                    ((ListView) this.z.h).setAdapter((ListAdapter) this.aa);
                                                    this.aa.c = new ff.b(this);
                                                    this.z.a.setOnClickListener(new ff.a(this, 0));
                                                    this.z.c.setOnClickListener(new ff.a(this, 1));
                                                    new s.b(this, false, x, true);
                                                    return;
                                                }
                                            }
                                            fi.y.f(this, "请求网络中...");
                                            t.c().j(((Home) dq.b.b(Home.class)).getSetList().subscribeWith(new a(this, this)));
                                            ((ListView) this.z.h).setAdapter((ListAdapter) this.aa);
                                            this.aa.c = new ff.b(this);
                                            this.z.a.setOnClickListener(new ff.a(this, 0));
                                            this.z.c.setOnClickListener(new ff.a(this, 1));
                                            new s.b(this, false, x, true);
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        com.gyf.immersionbar.f r = com.gyf.immersionbar.f.r(this);
        boolean z = !r.e.c(this);
        r.h.e = z;
        if (z && !OSUtils.isMIUI6Later()) {
            OSUtils.isFlymeOS4Later();
        }
        r.h.getClass();
        r.h.getClass();
        r.v();
    }
}
